package org.jeecg.modules.scm.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.scm.entity.ScmIndustryType;
import org.jeecg.modules.scm.mapper.ScmIndustryTypeMapper;
import org.jeecg.modules.scm.service.IScmIndustryTypeService;
import org.springframework.stereotype.Service;

import java.util.List;

import static org.jeecg.modules.scm.common.util.StringConversion.changeForFuzzy;

/**
 * @Description: scm_industry_type
 * @Author: jeecg-boot
 * @Date:   2021-10-28
 * @Version: V1.0
 */
@Service
public class ScmIndustryTypeServiceImpl extends ServiceImpl<ScmIndustryTypeMapper, ScmIndustryType> implements IScmIndustryTypeService {

    /**
     * 模糊查询
     * */
    @Override
    public List<ScmIndustryType> fuzzyQueryIndustry(String industryType){
        List<ScmIndustryType> list = null;
        if(StringUtils.isNotBlank(industryType)){
            String res = changeForFuzzy(industryType);
            list = lambdaQuery().select(ScmIndustryType::getId, ScmIndustryType::getIndustryName)
                    .like(ScmIndustryType::getIndustryName, res)
                    .list();
        }else{
             list = lambdaQuery().select(ScmIndustryType::getId, ScmIndustryType::getIndustryName)
                    .list();
        }
        return list;
    }

}
